/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.telsoft.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 *
 * @author rongnk
 */
@FacesConverter("booleanConvert")
public class BooleanConverter implements Converter {

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        Boolean bl = false;
        if(value.equals("true")){
            bl = true;
        }
        return bl;
    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        Boolean bl = (Boolean) value;
        return bl.toString();
    }
    
}
